package com.project.service;

import java.util.List;

import com.project.dao.CommentServiceDao;
import com.project.entity.Document;
import com.project.entity.Idea;
import com.project.entity.Ideacomment;
import com.project.util.DateUtil;
import com.project.util.PKUtil;
import com.project.util.Page;

public class CommentService {
	CommentServiceDao csd=new CommentServiceDao();
	public void save(String ideaid, String cont, String userid) {
		
		Ideacomment ic=new Ideacomment();
		ic.setId(PKUtil.getId());
		ic.setCont(cont);
		ic.setCreatetime(DateUtil.getNow());
		ic.setIdeaid(ideaid);
		ic.setUserid(userid);
		csd.save(ic);
		
	}
	
	public List<Ideacomment> findCommentByIdeaid(String id) {

		return csd.findCommentByIdeaid(id);
	}
	public void delCommentById(String id) {
		csd.delCommentById(id);
	}

	public void delAllCommentById(String id) {
		csd.delAllCommentById(id);
	}

	/*public Page<Idea> findByIdeaid(String id, String p) {

		int pageNum = 0;
		if("".equals(p) || p == null) {
			pageNum = 1;
		} else {
			try {
				pageNum = Integer.parseInt(p);
			} catch (Exception e) {
				pageNum = 1;
			}
		}
		
		Page<Idea> page = new Page<Idea>(5,csd.getCount(),pageNum);
		
		return csd.findDocumentByIdeaId(id, page);
	}*/


}
